import $ from '../common'
Page({
	data: {},
	bindmessage(e){
		if($.parent().$bindmessage){
			$.parent().$bindmessage(e)
		}
	},
	onLoad(e) {
		wx.setNavigationBarTitle({
			title: e.title || ''
		})
		let allUrl = ""
		let url = unescape(e.url)
		let code = e.code || ""
		if(url.indexOf("://") > -1){
			allUrl = url
		}else{
			if(url.indexOf("?") == -1){
				url += "?"
			}else{
				url += "&"
			}
			url += ("token=" + $.token() + "&wx_code=" + code + "&id=" + wx.getStorageSync('cmp_uuid') + "&webview_uuid=" + $.uuid())
			let root = $.requestUrl()
			if(root == "https://www.zjkeday.cn"){
				//root = "https://www.shuixingzhou.com"
			}
			allUrl = root + url
		}
		this.setData({
			url: allUrl
		})
	}
})